<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_voucher.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%@page import="com.lmpop.trade.ts_custclass.*" %>
<%
	request.setCharacterEncoding("UTF-8");
	Hashtable ti_paymentrules = new Hashtable();
	String req_vouchertype="";
	String req_limitnumber="";
	String req_memberlevel="";
	if(request.getParameter("req_vouchertype")!=null && !request.getParameter("req_vouchertype").equals("")){
		req_vouchertype = request.getParameter("req_vouchertype");
		ti_paymentrules.put("voucher_type",req_vouchertype);
	}
	if(request.getParameter("req_limitnumber")!=null && !request.getParameter("req_limitnumber").equals("")){
		req_limitnumber = request.getParameter("req_limitnumber");
		ti_paymentrules.put("limit_number",req_limitnumber);
	}
	if(request.getParameter("req_memberlevel")!=null && !request.getParameter("req_memberlevel").equals("")){
		req_memberlevel = request.getParameter("req_memberlevel");
		ti_paymentrules.put("member_level",req_memberlevel);
	}
	Ti_PaymentRulesInfo ti_paymentrulesInfo = new Ti_PaymentRulesInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_paymentrulesInfo.getListByPage(ti_paymentrules,Integer.parseInt(iStart),limit);
	int counter = ti_paymentrulesInfo.getCountByObj(ti_paymentrules);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?iStart=",Integer.parseInt(iStart),limit);

	Map custclassinfoMap = new Hashtable();
	custclassinfoMap.put("class_type","1");
	Ts_custclassInfo custclassinfo = new Ts_custclassInfo();
	String custclass_select =  custclassinfo.getSelectString(custclassinfoMap,"");
	Map classmaps=custclassinfo.getCust_classname();
	Map rulesMap=new Hashtable();
	Ti_PaymentRulesInfo ti_paymentruleInfo =new Ti_PaymentRulesInfo();
	String rules_select=ti_paymentruleInfo.getSelectString("");
	
%>
<html>
  <head>
    
    <title>发放规则设置</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="index.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>发放规则设置</h1>
			</td>
			<td>
				<a href="paymentrules.jsp"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="paymentrules_index.jsp" name="indexForm" method="post" >
	
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
					<input name="req_vouchertype" id="voucher_type" type="hidden"/>
					优惠券类型:<select onclick="setType(this)">
									<option value="">请选择</option>
								  	<%=rules_select%>
						</select>
					
					会员级别:<select name="req_memberlevel" id="member_level" >
									<option value="">请选择</option>
								  	<%=custclass_select%>
					</select>
		  		
					限制数量:<input name="req_limitnumber" type="text" size="5" maxlength="5" onKeyUp="if(isNaN(value))this.value=''"/>&nbsp;
		  		
		  		

				<input name="searchInfo" type="button" value="搜索" onclick="return search('paymentrulesForm');"/>	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			
		  	<th>优惠券类型</th>
		  	
		  	<th>会员级别</th>
		  	
		  	<th>限制数量</th>
		  	
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String rule_id="",voucher_type="",member_level="",limit_number="";
		  			if(map.get("rule_id")!=null) rule_id = map.get("rule_id").toString();
  				    if(map.get("voucher_type")!=null) voucher_type = map.get("voucher_type").toString();
  				    if(map.get("member_level")!=null) member_level = map.get("member_level").toString();
  				    if(map.get("limit_number")!=null) limit_number = map.get("limit_number").toString();
		  %>
		                                  
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=rule_id %>" /></td>
			
		  	<td><%=voucher_type%></td>
		  	
		  	<td><%
						if(classmaps!=null&&classmaps.get(member_level)!=null ){%>
							<%=classmaps.get(member_level) %>
						<%}else{
					%>
						无
					<%} %></td>
		  	<td><%=limit_number%></td>
		  	
			<td width="10%"><a href="updatePaymentRules.jsp?rule_id=<%=rule_id %>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:deleteOneInfo('<%=rule_id%>','9013');"><img src="/program/admin/images/delete.gif" title="删除" /></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize%>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="9013" />
	  </form>
</body>

</html>

